package com.geek.netty.demo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

/**
 * @program netty-server
 * @description: main
 * @author: chanzhugang
 * @create: 2021/08/16 15:11
 */
public class ClientMain {

    public static void main(String[] args) {

        DemoServer server = new DemoServer();
        server.start();

        try (Socket client = new Socket(InetAddress.getLocalHost(), 8080)) {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(client.getInputStream()));
            bufferedReader.lines().forEach(s -> System.out.println(s));
        } catch (UnknownHostException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}